<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp"%>
<html>
<head>
<title>图书信息管理</title>
<%@include file="/common/ec.jsp" %>
<%@include file="/common/extjs.jsp" %>
<%@include file="/common/meta.jsp" %>
<script type="text/javascript">
function removeBook(bookId) {
    Ext.MessageBox.confirm('提示','确实要删除该图书信息吗？删除后不能恢复！', function(btn){
        if (btn == 'yes') {
        	location.href="remove.do?model.id=" + bookId;
        }
    });
  }
</script>
</head>
<body>
<div><%@ include file="/common/messages.jsp"%></div>
<div class="x-panel">
<div class="x-panel-header">图书管理</div>
<div class="x-toolbar">
<table width="99%">
	<tr>
		<s:form action="index.do" method="post">
		<td>
		&nbsp;图书名称：<s:textfield name="model.name" cssStyle="width:100px"/>&nbsp;
		<!--
		ISBN：<s:textfield name="model.isbn" cssStyle="width:100px"/>&nbsp;
		-->
		类型：<INPUT TYPE="checkbox" NAME="bkTypes" VALUE="1" class="chan"><span class="cha" style="color:blue;">新书</span>
			  <INPUT TYPE="checkbox" NAME="bkTypes" VALUE="2" class="chan"><span class="cha" style="color:green;">热销</span>
			  <INPUT TYPE="checkbox" NAME="bkTypes" VALUE="3" class="chan"><span class="cha" style="color:red;">特价</span>&nbsp;
		年级：<s:select id="grade" list="gradeMap" name="model.grade" headerKey=""
								headerValue="--选择年级--" cssStyle="width:120px"></s:select>&nbsp;
		学科：<s:select id="subjectId" name="model.subject.id" list="subjectList" listKey="sjId" listValue="sjName"
								headerKey="" headerValue="--选择学科--" cssStyle="width:120px" />
		&nbsp;<input type="submit" value="查询" class="button" />
		</td>
		</s:form>
		<td align="right">
		<table>
			<tr>
				<td valign="middle"><a href="edit.do"><img src="${ctx}/images/icons/add.gif"/> 添加</a></td>
             	<td><span class="ytb-sep"></span></td>
				<td><a href="${ctx}/book/index.do"><img src="${ctx}/images/icons/house.gif"/> 列表</a></td>
			</tr>
		</table>
		</td>
	</tr>
</table>
</div>
<div class="x-panel-body">
<div style="margin-left: -3px;" align="center">
<ec:table
	items="items" var="item" retrieveRowsCallback="limit" sortRowsCallback="limit"
	action="index.do" 
	useAjax="false"
	doPreload="false" 
	pageSizeList="30,50,100,200" 
	editable="false"
	sortable="false" 
	rowsDisplayed="30" 
	generateScript="true"
	resizeColWidth="false" 
	classic="false" 
	width="100%" 
	height="460px"
	minHeight="460"
	toolbarContent="navigation|pagejump|pagesize|refresh|extend|status">
	<ec:row>
		<ec:column width="40" property="_no" value="${GLOBALROWCOUNT}" title="序号" style="text-align:center"/>
		<ec:column width="230" property="name" title="图书名称" >
			<a href="view.do?model.id=${item.id}" target="_blank" title="查看图书信息"><font color="blue">${item.name}</font></a>
		</ec:column>
		<ec:column width="100" property="bkType" title="类型" mappingItem="bookTypeMap"/>
		<ec:column width="80" property="price" title="价格(元)" />
		<ec:column width="80" property="stock" title="库存" />
		<ec:column width="80" property="grade" title="年级" mappingItem="gradeNameMap" style="text-align:center"/>
		<ec:column width="95" property="subject.name" title="学科类别" style="text-align:center"/>
		<ec:column width="140" property="_0" title="操作" style="text-align:center" sortable="false">
			<a href="edit.do?model.id=${item.id}">编辑</a> |
			<a href="view.do?model.id=${item.id}" target="_blank">查看</a> |
			<a href="#" onClick="removeBook(${item.id})">删除</a>
		</ec:column>
	</ec:row>
</ec:table></div>
</div>
</div>
</body>
</html>